package com.xiangge.test;

import java.util.Arrays;
import java.util.Random;

public class Demo5 {
    public static void main(String[] args) {
        int[] scores = new int[6];
        for (int i = 0; i < scores.length; i++) {

            scores[i] = new Random().nextInt(101);
        }
        System.out.println(Arrays.toString(scores));
        int max = 0;
        int min = scores[0];
        for (int score : scores) {
            if (score>max){
                max = score;
            }
            if (score<min){
                min = score;
            }
        }
        System.out.println("max = " + max);
        System.out.println("min = " + min);
        double sum = 0.0;

        for (int score : scores) {
            if (score==max||score==min){
                continue;
            }
            sum+=score;
//            System.out.println("sum = " + sum);
        }

        System.out.println("去掉最高最低总分：" + sum);
        System.out.println("平均分为："+(sum/scores.length));
    }
}
